package com.travel.controller;

import com.travel.pojo.TravelContent;
import com.travel.result.Result;
import com.travel.service.TravelContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 问栢
 * Date: 2021/09/28
 * Description:
 */
@Api(tags = "后台管理用户协议设置")
@RestController
@RequestMapping("/travel/content")
public class TravelContentController {

    @Autowired
    private TravelContentService travelContentService;

    @ApiOperation("获取用户协议数据")
    @GetMapping("/list")
    public Result list() {
        return Result.success(travelContentService.list());
    }

    @ApiOperation("修改用户协议数据")
    @PutMapping("/update/{id}")
    public Result update( @PathVariable Integer id , @RequestBody TravelContent travelContent) {
        travelContent.setId(id);
        travelContentService.updateById(travelContent);
        return Result.success("修改成功");
    }
}
